import request from '@/axios/request';
import url from '@/axios/url';
const { mesUrl, adminUrl } = url();
// 导出url
export const exportUrl = `${mesUrl}mesRequisitionOrderMaterials/export`
// 分页查询
export function getList (params = {}) {
  return request({
    url: `${mesUrl}mesRequisitionOrderMaterials`,
    method: 'get',
    params,
  });
}
// 新增
export function rowCreate (data = {}) {
  return request({
    url: `${mesUrl}mesRequisitionOrderMaterials`,
    method: 'post',
    data,
  });
}
// 修改
export function rowUpdate (data = {}) {
  return request({
    url: `${mesUrl}mesRequisitionOrderMaterials`,
    method: 'put',
    data,
  });
}
// 删除
export function rowDel (id) {
  return request({
    url: `${mesUrl}mesRequisitionOrderMaterials/${id}`,
    method: 'put',
  });
}
// 详情
export function rowDetail (id) {
  return request({
    url: `${mesUrl}mesRequisitionOrderMaterials/info/${id}`,
    method: 'get',
  });
}

// 导入用户
export function importData (data = {}) {
  return request({
    url: `${mesUrl}mesRequisitionOrderMaterials/import`,
    method: 'POST',
    data,
    headers: {
      'Content-Type': 'multipart/form-data',
    }
  })
}
// 下载模板
export const downloadTemplateUrl = `${mesUrl}mesRequisitionOrderMaterials/template`

// 状态 0-新建，1-领料中，2-已完成，3-关闭
export function getStatusList () {
  return request({
    url: `${adminUrl}dict/type/mes_pick_status`,
    method: "get",
  });
}
// 查询配送车间编码列表
export function getReturnWorkshopCodeList (params) {
  return request({
    url: `${adminUrl}baseFactoryModeling/children`,
    method: "get",
    params,
  });
}
// 关闭明细
export function closeOrder (ids) {
  return request({
    url: `${mesUrl}mesRequisitionOrderMaterials/closeOrder/${ids}`,
    method: "POST"
  });
}
// 关闭明细
export function getMaterialListByIdInfo (data) {
  return request({
    url: `${mesUrl}mesRequisitionOrderMaterials/getMaterialListById`,
    method: "POST", data
  });
}
// 状态 WMS单据出库类型
export function getWmsOutOrderType () {
  return request({
    url: `${adminUrl}dict/type/wms_out_order_type`,
    method: "get",
  });
}